﻿package src.style 
{
	
	/**
	* 
	* Reliability project
	* -----------------------
	* @author  Dmitrij Boycov
	* @mail    dmitry.boycov@gmail.com
	* @date    April 27, 2010
	* @version 1
	* 
	*/
	
	public class Style{
		
		private static var instance:OwnerEvent;
		private static var allowInstantiation:Boolean;
		//
		private var shemeStyle:Dictionary = new Dictionary(true);// true - delete elements 
		
		public function Style():void{		
			if (!allowInstantiation) {
				throw new Error("Error: Instantiation failed: Use SingletonDemo.getInstance() instead of new.");
			}		
		}
		
		public static function getInstance():OwnerEvent{
			if (instance == null) {
				allowInstantiation = true;
				instance = new OwnerEvent();
				allowInstantiation = false;
				this.loadStyle();
			}
			return instance;
		}
		
		private function loadStyle() {
			var urlRequest:URLRequest = new URLRequest("src/style/scheme.xml");
			var urlLoader:URLLoader = new URLLoader();
			urlLoader.addEventListener (Event.COMPLETE,fileLoaded);
			urlLoader.load(urlRequest);
		}
		
		private function onLoad(event:Event):void {
			var xml = XML(event.target.data);
			//var xmlList = myXML.children();		
		}
	
}